package pl.softech.oldchart;

import java.awt.geom.Point2D;
import java.text.DateFormat;
import java.text.NumberFormat;
import java.util.Calendar;
import java.util.Collection;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;

import pl.softech.oldchart.AbstractGraph2DModel;

public class SimpleData4 extends AbstractGraph2DModel {

	private List<Point2D> list = new LinkedList<Point2D>();
	private Map<Double, String> xAxisLabels = new HashMap<Double, String>();
	private Map<Double, String> yAxisLabels = new HashMap<Double, String>();
	private static final DateFormat format = DateFormat.getInstance();
	private static final NumberFormat nb = NumberFormat.getInstance();
	public SimpleData4() {
		double a = 1;
		double b = 1;
		double y;
		Calendar calc = Calendar.getInstance();
		nb.setMinimumFractionDigits(2);
		for(double x = 1; x < 8; x++) {
			y = a * x + b;
			list.add(new Point2D.Double(x,y));
			xAxisLabels.put(x, "" + format.format(calc.getTime()));
			yAxisLabels.put(y, "" + nb.format(y));
			calc.add(Calendar.DAY_OF_YEAR, (int)x);
		}
		
	}
	
	@Override
	public double getMaxX() {
		
		return 10;
	}

	@Override
	public double getMaxY() {
		
		return 10;
	}

	@Override
	public double getMinX() {
		
		return 0;
	}

	@Override
	public double getMinY() {
		
		return 0;
	}

	@Override
	public Collection<Point2D> getPoints() { return list; }

	@Override
	public Map<Point2D, String> getPointsLabels() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public Map<Double, String> getXAxisLabels() {
		
		return xAxisLabels;
	}

	@Override
	public Map<Double, String> getYAxisLabels() {
		
		return yAxisLabels;
	}

	@Override
	public boolean showXAxisLabels() {
		// TODO Auto-generated method stub
		return true;
	}

	@Override
	public boolean showYAxisLabels() {
		// TODO Auto-generated method stub
		return true;
	}

	@Override
	public String getName() {
		// TODO Auto-generated method stub
		return "wykres słupkowy 1";
	}
	
}